package com.wyz.saas.app.mvvm.main

import android.util.Log
import android.view.View
import androidx.databinding.ObservableField
import com.atom.module.mvvm.adapter.ClickEvent
import com.atom.module.mvvm.adapter.VisitEvent
import com.atom.module.mvvm.base.AbstractBaseViewModel
import com.atom.module.mvvm.base.EmptyModel
import com.atom.module.mvvm.base.AbstractViewModel
import com.atom.module.mvvm.livedata.SingleLiveData
import com.wyz.saas.app.mvvm.list.ListActivity

class MainViewModel : AbstractBaseViewModel<EmptyModel> {

    constructor(id: Int, model: EmptyModel) : super(id, model)

    val hello: ObservableField<String> = ObservableField("asdasdasdasd")

    val skipListActivity = object : SingleLiveData<View>(){}

    val event2 = object : ClickEvent<Unit>() {
        override fun invoke(t: View) {
            Log.e("MainViewModel", "aa2 > ${System.currentTimeMillis()}  ${t.id}")
            dialogAction.set( "asdasdasdasd")
        }
    }

    val show = VisitEvent(View.GONE)


    fun aa2(v: View) {
        Log.e("MainViewModel", "aa2 > ${System.currentTimeMillis()}")
        hello.set("asdad");
        startActivity(ListActivity::class.java)
    }

    fun aa3() {
        if (show.get() != View.GONE) {
            show.set(View.GONE)
        } else {
            show.set(View.VISIBLE)
        }
    }
}